<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('历史处理记录')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "gaoxin/system/mTelWF";

    $(function () {
        var options = {
            url: prefix + "/forShow/logListJson/"+[[${wfId}]],
            detailUrl:  prefix+"/forShow/logDetail/{id}",
            sortName: "logId",
            sortOrder: "desc",
            uniqueId: "logId",
            modalName: "历史处理记录",
            columns: [
                {field:'logId',title:'流水号',visible:false},
                {field:'wfId',title:'WfId',visible:false},
                {field:'opTime',title:'操作时间',align:'center',sortable:true},
                {field:'opDeptName',title:'单位名称',align:'center',sortable:true},
                {field:'opUserName',title:'操作人',align:'center',sortable:true},
                {field:'opAction',title:'动作',align:'center'},
                {field:'opDesc',title:'操作简述',align:'center',width:420},
                {field:'wsOpen',title:'公开',align:'center',sortable:true,formatter:function(value,row,index){return fmtWFormOpen(value,row,index);}},
                {field:'wsDesc',title:'公开内容',align:'center',width:110},
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.logId + '\')"><i class="fa fa-edit"></i>详情</a> ');
                        actions.push('<a class="btn btn-danger btn-xs " href="javascript:void(0)" onclick="updateOpen(\'' + row.logId + '\')"><i class="fa fa-remove"></i>切换公开</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    //切换公开状态
    function updateOpen(pkValue){
        $.ajax({
            type: "post",
            url: prefix+"/forShow/updateState/" + pkValue,
            success: function(){
                $.modal.msgSuccess("切换成功");
                $.table.refresh();
            }
        });
    }
</script>
</body>
</html>